package com.team.teamuserservice.controller;


import com.team.teamuserservice.service.IBizRescueTaskService;
import com.team.teamuserservice.uitls.Result;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/cxs/rescue")
@RequiredArgsConstructor
public class MerchantController {

    private final IBizRescueTaskService bizRescueTaskService;



    /**
     * 前端商家接收到了用户的救援信息 , 抢单
     */
    @GetMapping
    public Result acceptRescue(@RequestParam("userId") Long userId , @RequestParam("merchantId") Long merchantId) throws InterruptedException {
         Boolean success = bizRescueTaskService.acceptRescue(userId,merchantId);
         if ( success){
             return Result.success();
         }
         return Result.error("抢单失败");
    }
}
